package cn.wolfcode.ssm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.wolfcode.ssm.domain.Department;
import cn.wolfcode.ssm.mapper.DepartmentMapper;
import cn.wolfcode.ssm.service.IDepartmentService;

/**
 * 部门服务接口实现类
 * @author Administrator
 *
 */
@Service   //将当前部门服务对象交给spring管理起来
public class DepartmentServiceImpl implements IDepartmentService {
	
	@Autowired
	private DepartmentMapper departmentMapper;

	public void save(Department entity) {
		departmentMapper.insert(entity);
	}

	public void update(Department entity) {
		departmentMapper.updateByPrimaryKey(entity);
	}

	public void delete(Long id) {
		departmentMapper.deleteByPrimaryKey(id);
	}

	public Department get(Long id) {
		return departmentMapper.selectByPrimaryKey(id);
	}

	public List<Department> list() {
		return departmentMapper.selectAll();
	}

}
